package com.spring.security.study.security_test.api;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

/**
 * @ClassName : SysUserDetails
 * @Author : lby
 * @Date: 2021/1/25 15:14
 * @Description : 重写security中的userDetails类
 */
@Data
public class SysUserDetails implements Serializable, UserDetails {

    private String userId;

    private String userName;

    private String password;


    /**
     * 用户权限集合
     */
    private Collection<GrantedAuthority> authorities;

    @Override
    public String getUsername() {
        return userName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return false;
    }
}
